package py.patch.copy;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import py.patch.match.LastestFileUtil;


public class FileCopyMainByTime {
	public static void main(String[] args) {
		FileCopy copy = new FileCopy();
		
		String path = "D:\\worka\\jiazia-v1\\jiazheng-v1-admin\\target\\admin";
		copy.setSrcDir(path);
		
		SimpleDateFormat simpleDateFormat =new SimpleDateFormat("yyyyMMddhhmm");
		
		copy.setTargetDir(path+"\\"+simpleDateFormat.format(new Date()));
		
		
		List<String> fileExt = new ArrayList<String>();
		fileExt.add(".html");
		fileExt.add(".js");
		fileExt.add(".class");
		
		try {
			List<String> resultFileName = new ArrayList<String>();
			List<String> files = LastestFileUtil.ergodic(new File(path), resultFileName  ,fileExt, 24*60*60*1000);
			copy.copyFile(files);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
	}
	
}
